<?php
/*
PWision extension: Newspaper http://pw-newspaper.googlecode.com/
Copyright (C) 2010 Becheru Petru-Ioan

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
include_once("inc/PRedirectSection.inc");
include_once("inc/PFormSection.inc");
include_once("pw-newspaper.inc");
/** 	The rmArticle class is designed to delete an article.
	*	\latexonly  \label{PWision:Extensions:Newspaper:rmArticle} \index{extension} \index{newspaper} \index{article} \endlatexonly
	*	\brief delete an article section.
	*	\version 1.0.1
	*/
class rmArticle extends PFormSection
	{
	function setParams()
		{
		$this
			->addParam('ID','/^[0-9]{1,10}$/')
			;
		}
	function ProcessOK()
		{
		$article=NewsPaper::getArticleInfo($this->getParam('ID'));
		NewsPaper::rmArticle($this->getParam('ID'));
		$this->AddMessage('Article "'.$article->Title.'" ID='.$article->ID.' deleted!');
		return true;
		}
	function createForm()
		{
		return PFormSection::createForm()
			->Insert(new PText('Enter the ID of the article:') )
			->Insert( new PInput("text",'','ID') )
			->Insert(new PInput("submit","Delete article!",""))
			;
		}
	}

?>